<form action="{:U(GROUP_NAME . '/Category/editCategory')}" method="post" enctype="multipart/form-data">
<table class="table table-bordered table-hover definewidth m10">
    <tr>
        <td width="10%" class="tableleft">选择模型</td>
        <td>
            <select name="model_table" id="">
                <foreach name="modelTable" item="v">
                    <option value="{$key}" <if condition="$result['model_table'] eq $key">selected</if>>{$v}</option>
                </foreach>
            </select>
        </td>
    </tr>
    <tr>
        <td class="tableleft">
            上级栏目
        </td>
        <td>
            {:W('SelectorTree',$category)}
        </td>
    </tr>
    <tr>
        <td class="tableleft">
            栏目类型
        </td>
        <td>
            列表类型 <input type="radio" name="type" value="0" <if condition="$result['type'] eq 0">checked</if> checked/>&nbsp;&nbsp;
            单页面 <input type="radio" name="type" value="1" <if condition="$result['type'] eq 1">checked</if>/>
        </td>
    </tr>
    <tr>
        <td class="tableleft">栏目名称</td>
        <td><input type="text" name="name" value="{$result.name}"/></td>
    </tr>
    <tr>
        <td class="tableleft">栏目图片</td>
        <td>
            <ul>
                <foreach name="images" item="v">
                    <if condition="$v">
                        <li style="padding:5px;">
                            <img src="__UPLOADS__/thumb_{$v}" width="100" height="100" alt=""/>
                            <input type="text" name="images[]" value="{$v}"/>
                            <a href="#" class="delImage">移除</a>
                        </li>
                    </if>
                </foreach>
            </ul>
            <a href="#" class="addImage">添加</a>
        </td>
    </tr>
   <tr class="tr-next">
        <td class="tableleft"></td>
        <td>
            <input type="hidden" name="id" value="{$result.id}"/>
            <button type="submit" class="btn btn-primary" type="button">保存</button>
            &nbsp;&nbsp;<button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>
        </td>
    </tr>

</table>
</form>
<script type="text/javascript">
    $(function(){
        $("#parent_id").val('{$result.parent_id}');
        $('.addImage').click(function(){
            var obj = $('<tr><td></td><td><input name="image[]" type="file" /></td></tr>');
            $('.tr-next').before(obj);
        });
        $('.delImage').click(function(){
            $(this).parents('li').remove();
        });
    })
</script>